<?php 

class CepModel extends GenericModel{
	public function __construct(){
		$this->setTableName('tb_categoria');
		parent::__construct();
	}

	public function getEnderecoPorCep($cep){
		
		$result = $this->query("SELECT
									L.CEP as CEP,
									L.UFE_SG as Estado,
									C.LOC_NO as Cidade,
									B.BAI_NO as Bairro,
									CONCAT(L.TLO_TX, ' ', LOG_NO) as Logradouro
								FROM
									LOG_LOGRADOURO L
									INNER JOIN LOG_BAIRRO B ON (L.BAI_NU_INI = B.BAI_NU)
									INNER JOIN LOG_LOCALIDADE C ON (C.LOC_NU = B.LOC_NU)
								WHERE
									L.CEP = ?", array($cep), true);
		
		return $result;
		
		
	}
}

?>